#include "mg_EEPROM_app.h"
#include "mg_file.h"
#include "mg_Rs485Protocol.h"
#include "mg_child_device.h"
#include "../scene.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*******************************EEPROM应用层*****************************/
#define SAVE_DATA_SIZE_MAX					256
uint8_t g_SaveDataInfo[SAVE_DATA_SIZE_MAX] = { 0 };
//存储系统数据
void WriteSystemData(void)
{
	STRUCT_INFO_SAVE Save_Data;
	Save_Data.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	Save_Data.Save_Data_Len = sizeof(SYSTEM_EEPROM_VALUE);
	Save_Data.Save_Data = (uint8_t *)&Sys;
	BSP_EEPROM_Save(EEPROM_Sys_Info_ADDR, &Save_Data.Save_Flag, 2);
	BSP_EEPROM_Save(EEPROM_Sys_Info_ADDR + 2, Save_Data.Save_Data, Save_Data.Save_Data_Len);
	printf("Moorgen INFO : Write Sys_Struct Over.\n");
}
//存储系统配置参数
void SaveSystemConfigData(uint8_t Start_Addr, uint8_t size)
{
	if (Start_Addr + size>sizeof(Sys_Config))return;
	BSP_EEPROM_Save(EEPROM_Sys_Config_ADDR + Start_Addr, (uint8_t*)&Sys_Config.ConfigTable[Start_Addr], size);
	BSP_EEP_WriteOneByte(EEPROM_Sys_Config_ADDR, EEPROM_INFO_SAVE_FLAG);
}
//存储设备状态(0xFF:全部存储)
void WriteDeviceData(uint8_t DeviceKeyVol)
{
	uint8_t i;
	//存单个设备属性
	if (DeviceKeyVol <= DeviceNumMax && DeviceKeyVol != 0)
	{
		printf("Moorgen INFO : Save TFT_Device No.%d config data\n", DeviceKeyVol);
		printf("Moorgen INFO : TFT_Device[%d].DeviceIsAllocation = %d\n", DeviceKeyVol, TFT_Device[DeviceKeyVol].DeviceIsAllocation);
		printf("               TFT_Device[%d].DeviceKeyVol = %d\n", DeviceKeyVol, TFT_Device[DeviceKeyVol].DeviceKeyVol);
		printf("               TFT_Device[%d].DeviceEventType = %d\n", DeviceKeyVol, TFT_Device[DeviceKeyVol].DeviceEventType);
		BSP_EEPROM_Save(EEPROM_Device_Info_ADDR + (DeviceKeyVol - 1) * 256, (uint8_t *)&TFT_Device[DeviceKeyVol], sizeof(Type_TFT_Device));
		printf("Moorgen INFO : Write single TFT_Device config Over.\n");
	}
	//存所有设备属性
	else if (DeviceKeyVol == 0xFF)
	{
		printf("Moorgen INFO : Save all TFT_Device config data\n");
		for (i = 1; i <= DeviceNumMax; i++)
		{
			BSP_EEPROM_Save(EEPROM_Device_Info_ADDR + (i - 1) * 256, (uint8_t *)&TFT_Device[i], sizeof(Type_TFT_Device));
		}
		printf("Moorgen INFO : Write all TFT_Device config Over.\n");
	}
}
//储存子设备状态
//保存空调参数
void Save_Air_State(void)
{
	STRUCT_INFO_SAVE Save_Data;
	Save_Data.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	Save_Data.Save_Data_Len = sizeof(STRUCT_AIR_VALU);
	Save_Data.Save_Data = (uint8_t *)&Air;
	BSP_EEPROM_Save(EEPROM_Child_Device0_State_ADDR, &Save_Data.Save_Flag, 2);
	BSP_EEPROM_Save(EEPROM_Child_Device0_State_ADDR + 2, Save_Data.Save_Data, Save_Data.Save_Data_Len);
	printf("Moorgen INFO : Write Air State Over.\n");
}
void Read_Air_State(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Child_Device0_State_ADDR, (uint8_t *)&Load_Data, 2);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device0_State_ADDR + 2, (uint8_t *)&Air, Load_Data.Save_Data_Len);
	else
	{
		printf("Moorgen INFO : Load Air State error!\n");
		Air_State_Factory_Reset();
	}
}
void Save_Heat_State(void)
{
	STRUCT_INFO_SAVE Save_Data;
	Save_Data.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	Save_Data.Save_Data_Len = sizeof(STRUCT_HEAT_VALU);
	Save_Data.Save_Data = (uint8_t *)&Heat;
	BSP_EEPROM_Save(EEPROM_Child_Device1_State_ADDR, &Save_Data.Save_Flag, 2);
	BSP_EEPROM_Save(EEPROM_Child_Device1_State_ADDR + 2, Save_Data.Save_Data, Save_Data.Save_Data_Len);
	printf("Moorgen INFO : Write Heat State Over.\n");
}
void Read_Heat_State(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Child_Device1_State_ADDR, (uint8_t *)&Load_Data, 2);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device1_State_ADDR + 2, (uint8_t *)&Heat, Load_Data.Save_Data_Len);
	else
	{
		printf("Moorgen INFO : Load Heat State error!\n");
		Heat_State_Factory_Reset();
	}
}
void Save_Cdoas_State(void)
{
	STRUCT_INFO_SAVE Save_Data;
	Save_Data.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	Save_Data.Save_Data_Len = sizeof(STRUCT_CDOAS_VALU);
	Save_Data.Save_Data = (uint8_t *)&Cdoas;
	BSP_EEPROM_Save(EEPROM_Child_Device2_State_ADDR, &Save_Data.Save_Flag, 2);
	BSP_EEPROM_Save(EEPROM_Child_Device2_State_ADDR + 2, Save_Data.Save_Data, Save_Data.Save_Data_Len);
	printf("Moorgen INFO : Write Cdoas State Over.\n");
}
void Read_Cdoas_State(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Child_Device2_State_ADDR, (uint8_t *)&Load_Data, 2);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device2_State_ADDR + 2, (uint8_t *)&Cdoas, Load_Data.Save_Data_Len);
	else
	{
		printf("Moorgen INFO : Load Cdoas State error!\n");
		Cdoas_State_Factory_Reset();
	}
}
//储存子设备参数
//保存空调参数
void Save_Air_Config(uint8_t Start_Addr, uint8_t size)
{
	if (Start_Addr + size>sizeof(Air_Config))return;
	BSP_EEPROM_Save(EEPROM_Child_Device0_Config_ADDR + Start_Addr, (uint8_t*)&Air_Config.ConfigTable[Start_Addr], size);
	Air_Config.byte.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	BSP_EEPROM_Save(EEPROM_Child_Device0_Config_ADDR, (uint8_t*)&Air_Config.byte.Save_Flag, 1);
}
//保存空调部分参数
void Save_Air_Portion_Config(uint8_t *pConfig, uint8_t size)
{
	uint32_t offset = pConfig - Air_Config.ConfigTable;//地址偏移
	if ((offset > sizeof(Air_Config.ConfigTable)) ||
		((offset + size) > sizeof(Air_Config.ConfigTable)))
		return;
	BSP_EEPROM_Save(EEPROM_Child_Device0_Config_ADDR + offset, pConfig, size);
}
//读取地暖参数
void Read_Air_Config(void)
{
	BSP_EEPROM_Load(EEPROM_Child_Device0_Config_ADDR, (uint8_t *)&Air_Config, 1);
	if (Air_Config.byte.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device0_Config_ADDR, (uint8_t *)&Air_Config, sizeof(Air_Config));
	else
	{
		printf("Moorgen INFO : Load Air Config error!\n");
		Air_Config_Factory_Reset();
	}
}
//保存地暖参数
void Save_Heat_Config(uint8_t Start_Addr, uint8_t size)
{
	if (Start_Addr + size>sizeof(Heat_Config))return;
	BSP_EEPROM_Save(EEPROM_Child_Device1_Config_ADDR + Start_Addr, (uint8_t*)&Heat_Config.ConfigTable[Start_Addr], size);
	Heat_Config.byte.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	BSP_EEPROM_Save(EEPROM_Child_Device1_Config_ADDR, (uint8_t*)&Heat_Config.byte.Save_Flag, 1);
}
//保存地暖部分参数
void Save_Heat_Portion_Config(uint8_t *pConfig, uint8_t size)
{
	uint32_t offset = pConfig - Heat_Config.ConfigTable;//地址偏移
	if ((offset > sizeof(Heat_Config.ConfigTable)) ||
		((offset + size) > sizeof(Heat_Config.ConfigTable)))
		return;
	BSP_EEPROM_Save(EEPROM_Child_Device1_Config_ADDR + offset, pConfig, size);
}
//读取地暖参数
void Read_Heat_Config(void)
{
	BSP_EEPROM_Load(EEPROM_Child_Device1_Config_ADDR, (uint8_t *)&Heat_Config, 1);
	if (Heat_Config.byte.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device1_Config_ADDR, (uint8_t *)&Heat_Config, sizeof(Heat_Config));
	else
	{
		printf("Moorgen INFO : Load Heat Config error!\n");
		Heat_Config_Factory_Reset();
	}
}
//保存新风参数
void Save_Cdoas_Config(uint8_t Start_Addr, uint8_t size)
{
	if (Start_Addr + size>sizeof(Cdoas_Config))return;
	BSP_EEPROM_Save(EEPROM_Child_Device2_Config_ADDR + Start_Addr, (uint8_t*)&Cdoas_Config.ConfigTable[Start_Addr], size);
	Cdoas_Config.byte.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	BSP_EEPROM_Save(EEPROM_Child_Device2_Config_ADDR, (uint8_t*)&Cdoas_Config.byte.Save_Flag, 1);
}
//保存新风部分参数
void Save_Cdoas_Portion_Config(uint8_t *pConfig, uint8_t size)
{
	uint32_t offset = pConfig - Cdoas_Config.ConfigTable;//地址偏移
	if ((offset > sizeof(Cdoas_Config.ConfigTable)) ||
		((offset + size) > sizeof(Cdoas_Config.ConfigTable)))
		return;
	BSP_EEPROM_Save(EEPROM_Child_Device2_Config_ADDR + offset, pConfig, size);
}
//读取新风参数
void Read_Cdoas_Config(void)
{
	BSP_EEPROM_Load(EEPROM_Child_Device2_Config_ADDR, (uint8_t *)&Cdoas_Config, 1);
	if (Cdoas_Config.byte.Save_Flag == EEPROM_INFO_SAVE_FLAG)
		BSP_EEPROM_Load(EEPROM_Child_Device2_Config_ADDR, (uint8_t *)&Cdoas_Config, sizeof(Cdoas_Config));
	else
	{
		printf("Moorgen INFO : Load Cdoas Config error!\n");
		Cdoas_Config_Factory_Reset();
	}
}
//储存面板本身状态
void WriteDeviceNowData(void)
{
	STRUCT_INFO_SAVE Save_Data;
	Save_Data.Save_Flag = EEPROM_INFO_SAVE_FLAG;
	Save_Data.Save_Data_Len = sizeof(DEVICE_STATE_VALUE);
	Save_Data.Save_Data = (uint8_t *)&Dev;
	BSP_EEPROM_Save(EEPROM_Sys_State_ADDR, &Save_Data.Save_Flag, 2);
	BSP_EEPROM_Save(EEPROM_Sys_State_ADDR + 2, Save_Data.Save_Data, Save_Data.Save_Data_Len);
	printf("Moorgen INFO : Write Dev_Struct Over.\n");
}
//储存照片数据
void WritePhotoData(uint8_t Photo_Num)
{
	printf("Moorgen INFO : Write Photo%d Name:%s Filesize:%dByte.\n", Photo_Num, Photo_File[Photo_Num - 1].File_Name, Photo_File[Photo_Num - 1].File_Size);
	BSP_EEPROM_Save(EEPROM_UserPhoto1Info_ADDR + 0x40 * (Photo_Num - 1), &Photo_File[Photo_Num - 1], 40);
	BSP_EEPROM_Save(EEPROM_UserPhoto1_ADDR + PICTURE_MAX_SIZE * (Photo_Num - 1), Photo_File[Photo_Num - 1].File_Data, Photo_File[Photo_Num - 1].File_Size);
	printf("Moorgen INFO : Write Photo%d Over.\n", Photo_Num);
}
//读取照片数据
void ReadPhotoData(uint8_t Photo_Num)
{
	uint32_t Calculate_CRC32;
	BSP_EEPROM_Load(EEPROM_UserPhoto1Info_ADDR + 0x40 * (Photo_Num - 1), &Photo_File[Photo_Num - 1], 40);
	if (Photo_File[Photo_Num - 1].File_Size && Photo_File[Photo_Num - 1].File_Size <= PICTURE_MAX_SIZE)
	{
		BSP_EEPROM_Load(EEPROM_UserPhoto1_ADDR + PICTURE_MAX_SIZE * (Photo_Num - 1), Photo_File[Photo_Num - 1].File_Data, Photo_File[Photo_Num - 1].File_Size);
		Calculate_CRC32 = CRC32(Photo_File[Photo_Num - 1].File_Data, Photo_File[Photo_Num - 1].File_Size);
		if (Calculate_CRC32 == Photo_File[Photo_Num - 1].File_CRC32)//全文件CRC32校验
		{
			printf("Moorgen INFO : Read Photo%d Success.\n", Photo_Num);
		}
		else
		{
			printf("Moorgen INFO : Read Photo%d CRC Error, Clear photo data.Calculate_CRC32 = %08X File_CRC32 = %08X\n", Photo_Num, Calculate_CRC32, Photo_File[Photo_Num - 1].File_CRC32);
			memset(&Photo_File[Photo_Num - 1], 0, sizeof(FILE_TRANSFER_CACHE));
		}
	}
	else
	{
		memset(&Photo_File[Photo_Num - 1], 0, sizeof(FILE_TRANSFER_CACHE));
		printf("Moorgen INFO : Photo%d have no data!.\n", Photo_Num);
	}
}
//格式化EEPROM并写入出厂数据
void SystemDataReNew(void)
{
	unsigned char j;
	unsigned char Reset_Count;
	printf("Moorgen INFO : System factory data reset start......\n");
	//目录页写
	g_SaveDataInfo[0] = EEPROM_SAVE_FLAG;//EEPROM初始化标记
	Reset_Count = BSP_EEP_ReadOneByte(1);
	if (Reset_Count == 0xFF)
		Reset_Count = 1;
	else
		Reset_Count += 1;
	g_SaveDataInfo[1] = Reset_Count;//初始化次数（判断EEPROM意外初始化的重要标志）
	memcpy(&g_SaveDataInfo[2], SOFTWARE_VERSION, strlen(SOFTWARE_VERSION));
	BSP_EEPROM_Save(0, g_SaveDataInfo, 2 + strlen(SOFTWARE_VERSION));
	//出厂数据写入
	{
		//系统基本信息保存
		Sys.Type = DEVICE_TYPE;		//类型
		Sys.Addr = 0xFF;			//设备地址
		Sys.Channal = 1;			//通道数
		Sys.Language = MG_LANGUAGE_ZHTW;//语言
		Sys.IsDemoMode = false;
		Sys.TypeChl = DEVIC_TYPE_PANEL_NET_CHL;		//通道设备存在指示
		for (j = 0; j<DEVICE_CHANNEL_MAX; j++)
		{
			Sys.TypeChlNum[j] = 0xff;//通道类型号
		}
		Sys.TypeChlNum[0] = DEVIC_TYPE_PANEL_CHL;
		WriteSystemData();
		//系统配置保存
		memset(Sys_Config.ConfigTable, 0xFF, sizeof(Sys_Config.ConfigTable));
		Sys_Config.byte.Panal_EN = 0x01;
		Sys_Config.byte.FontSize = 0x00;
		Sys_Config.byte.SleepTimeover = 0xff;
		Sys_Config.byte.LightPercent = 80;
		Sys_Config.byte.MenuType = 0x04;
		Sys_Config.byte.Screensaver_En = 0x02;
		Sys_Config.byte.Screensaver_Type = 0x01;
		Sys_Config.byte.ScrollingTime = 5;
		memset(Sys_Config.byte.Surname, 0, sizeof(Sys_Config.byte.Surname));
#ifndef WIN32
		strcpy(Sys_Config.byte.Surname, "陈");
#endif
		Sys_Config.byte.Gesture_En = 0x02;
		Sys_Config.byte.Gesture_Config = 0x0F;
		Sys_Config.byte.Rotate_Light = 0x02;
		Sys_Config.byte.Rotate_Voice = 0x01;
		Sys_Config.byte.ScreensaverLoop_Select = 0x01FF;
		SaveSystemConfigData(1,0xFF);
		//系统状态保存
		Dev.LedRing_Switch = ON;
		Dev.LedRing_Brightness = 100;
		WriteDeviceNowData();
		//设备数据保存
		for (uint8_t i = 1; i <= DeviceNumMax; i++)
		{
			TFT_Device[i].DeviceIsAllocation = false;
			TFT_Device[i].DeviceEventType = 0;
			TFT_Device[i].DeviceKeyVol = i;
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceIcon = 0;
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceID.Value = 0;
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceType = 0xFFFF;
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
			strcpy(TFT_Device[i].TFTSCEQ.TFT_Device.DeviceName, "暫未配置");
			memset(TFT_Device_State[i].IT_Dev_STatus_Value.data, 0, sizeof(TFT_Device_State[i].IT_Dev_STatus_Value.data));
		}
		WriteDeviceData(0xFF);
		//用户照片数据
		for (uint8_t i = 0; i < PICTURE_MAX_NUM; i++)
		{
			memset((uint8_t*)&Photo_File[i], 0, 40);
			WritePhotoData(i + 1);
		}
	}
	printf("Moorgen INFO : System factory data reset completed.\n");
}
//初始化EEPROM,读取存储数据或写入默认数据
void EEprom_Init(void)
{
	uint8_t dat, Read_Count = 0, i;
	Eeprom_GPIO_Init();
	for (Read_Count = 0; Read_Count < 3; Read_Count++)//读三遍，防止读错
	{
		dat = BSP_EEP_ReadOneByte(0);
		if (dat == EEPROM_SAVE_FLAG)
			break;
		usleep(5000);
	}
	if (dat == EEPROM_SAVE_FLAG)//已格式化标记,读值
	{
		//系统基本信息读取
		Read_System_Info();
		//系统参数读取
		Read_System_Config();
		//读取设备状态
		Read_Air_State();
		Read_Heat_State();
		Read_Cdoas_State();
		Read_Air_Config();
		Read_Heat_Config();
		Read_Cdoas_Config();
		//读取设备参数
		Read_Device_Config();
		//读取面板本身状态
		Read_Device_NowData();
		//读取用户照片数据
		for (i = 1; i <= 3; i++)
			ReadPhotoData(i);
	}
	else
	{
		//格式化EEPROM，数据初始化(出厂值)
		printf("Moorgen INFO:EEPROM does not have data.\n");
		SystemDataReNew();
	}
	//是否在演示模式
	if (Sys.IsDemoMode)
	{
		Set_Debug_Dev_Config();
	}
}
//系统基本信息读取
void Read_System_Info(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Sys_Info_ADDR, (uint8_t *)&Load_Data, 2);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG && Load_Data.Save_Data_Len)
	{
		BSP_EEPROM_Load(EEPROM_Sys_Info_ADDR + 2, (uint8_t *)&Sys, Load_Data.Save_Data_Len);
		printf("Moorgen INFO : Sys.Type = 0x%04X\n", Sys.Type);
		printf("               Sys.Addr = 0x%02X\n", Sys.Addr);
		printf("               Sys.Channal = %d\n", Sys.Channal);
		printf("               Sys.Language = %d\n", Sys.Language);
		printf("               Sys.TypeChl = 0x%X\n", Sys.TypeChl);
	}
	else
	{
		printf("Moorgen INFO : Load Sys_info error!\n", Sys.Type);
	}
}
//系统配置信息读取
void Read_System_Config(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Sys_Config_ADDR, (uint8_t *)&Load_Data, 1);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG)
	{
		BSP_EEPROM_Load(EEPROM_Sys_Config_ADDR + 1, (uint8_t *)&Sys_Config.ConfigTable[1], 255);
		printf("Moorgen INFO : Sys_Config.byte.Panal_EN = %d\n", Sys_Config.byte.Panal_EN);
		printf("               Sys_Config.byte.FontSize = %d\n", Sys_Config.byte.FontSize);
		printf("               Sys_Config.byte.SleepTimeover = %d\n", Sys_Config.byte.SleepTimeover);
		printf("               Sys_Config.byte.LightPercent = %d\n", Sys_Config.byte.LightPercent);
		printf("               Sys_Config.byte.Screensaver_En = %d\n", Sys_Config.byte.Screensaver_En);
		printf("               Sys_Config.byte.Screensaver_Type = %d\n", Sys_Config.byte.Screensaver_Type);
		printf("               Sys_Config.byte.ScrollingTime = %d\n", Sys_Config.byte.ScrollingTime);
		printf("               Sys_Config.byte.Surname = %s\n", Sys_Config.byte.Surname);
		printf("               Sys_Config.byte.Gesture_En = %d\n", Sys_Config.byte.Gesture_En);
		printf("               Sys_Config.byte.Gesture_Config = %d\n", Sys_Config.byte.Gesture_Config);
		printf("               Sys_Config.byte.Rotate_Light = %d\n", Sys_Config.byte.Rotate_Light);
		printf("               Sys_Config.byte.Rotate_Voice = %d\n", Sys_Config.byte.Rotate_Voice);
		printf("               Sys_Config.byte.ScreensaverLoop_Select = 0x%04X\n", Sys_Config.byte.ScreensaverLoop_Select);
	}
	else
	{
		printf("Moorgen INFO : Load Sys_config error!\n", Sys.Type);
	}
}
//设备数据读取
void Read_Device_Config(void)
{
	uint8_t i;
	//设备数据读取
	for (i = 1; i <= DeviceNumMax; i++)
	{
		BSP_EEPROM_Load(EEPROM_Device_Info_ADDR + (i - 1) * 256, (uint8_t *)&TFT_Device[i], sizeof(Type_TFT_Device));
		//字符串长度合理化
		if (TFT_Device[i].DeviceEventType == 0x01)
		{
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceName[29] = 0;
			TFT_Device[i].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[i].TFTSCEQ.TFT_Device.DeviceName);
		}
		else
		{
			TFT_Device[i].TFTSCEQ.TFT_Scene.DeviceName[31] = 0;
			TFT_Device[i].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[i].TFTSCEQ.TFT_Scene.DeviceName);
		}
		printf("Moorgen INFO : TFT_Device[%d].DeviceIsAllocation = %d\n", i, TFT_Device[i].DeviceIsAllocation);
		printf("               TFT_Device[%d].DeviceKeyVol = %d\n", i, TFT_Device[i].DeviceKeyVol);
		printf("               TFT_Device[%d].DeviceEventType = %d\n", i, TFT_Device[i].DeviceEventType);
	}
}
//设备数据读取
void Read_Device_NowData(void)
{
	STRUCT_INFO_SAVE Load_Data = { 0 };
	BSP_EEPROM_Load(EEPROM_Sys_State_ADDR, (uint8_t *)&Load_Data, 2);
	if (Load_Data.Save_Flag == EEPROM_INFO_SAVE_FLAG && Load_Data.Save_Data_Len)
	{
		BSP_EEPROM_Load(EEPROM_Sys_State_ADDR + 2, (uint8_t *)&Dev, Load_Data.Save_Data_Len);
		printf("Moorgen INFO : Dev.LedRing_Switch = %d\n", Dev.LedRing_Switch);
		printf("               Dev.LedRing_Brightness = %d\n", Dev.LedRing_Brightness);
	}
	else
	{
		printf("Moorgen INFO : Load Dev_info error!\n", Sys.Type);
	}
}
//测试用的属性参数
void Set_Debug_Sys_Config(void)
{
	Sys.Language = MG_LANGUAGE_ZHTW;
	memset(Sys_Config.ConfigTable, 0xFF, sizeof(Sys_Config.ConfigTable));
	Sys_Config.byte.Panal_EN = 0x01;
	Sys_Config.byte.FontSize = 0x00;
	Sys_Config.byte.SleepTimeover = 0x01;
	Sys_Config.byte.LightPercent = 80;
	Sys_Config.byte.MenuType = 0x04;
	Sys_Config.byte.Screensaver_En = 0x02;
	Sys_Config.byte.Screensaver_Type = 0xAA;
	Sys_Config.byte.ScrollingTime = 5;
	memset(Sys_Config.byte.Surname, 0, sizeof(Sys_Config.byte.Surname));
	strcpy(Sys_Config.byte.Surname, "Sam");
	Sys_Config.byte.Gesture_En = 0x02;
	Sys_Config.byte.Gesture_Config = 0x0F;
	Sys_Config.byte.Rotate_Light = 0x02;
	Sys_Config.byte.Rotate_Voice = 0x01;
}
//测试用的设备参数
void Set_Debug_Dev_Config(void)
{
	uint8_t i;
#ifdef WIN32
	for (i = 1; i <= 1; i++)
	{
		TFT_Device[i].DeviceIsAllocation = true;
		TFT_Device[i].DeviceEventType = 1;
		TFT_Device[i].DeviceKeyVol = i;
		TFT_Device[i].TFTSCEQ.TFT_Device.DeviceIcon = 0;
	}
	for (i = 2; i <= DeviceNumMax; i++)
	{
		TFT_Device[i].DeviceIsAllocation = false;
		TFT_Device[i].DeviceEventType = 0;
		TFT_Device[i].DeviceKeyVol = i;
		TFT_Device[i].TFTSCEQ.TFT_Device.DeviceIcon = 0;
		strcpy(TFT_Device[i].TFTSCEQ.TFT_Scene.DeviceName, "");
		TFT_Device[i].TFTSCEQ.TFT_Scene.DeviceNameLen = 0;
	}
	if (Sys.Language == MG_LANGUAGE_CHS)
	{
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "回家");
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "离家");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "会客");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "聚餐");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "灯泡");
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "调光");
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_RGBCWLIGHT;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = 5;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "RGBCW");
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//H
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 0;//H
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//S
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[3] = 50;//B
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[4] = 50;//Colortemp
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[5] = 4;//Colortemp
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[6] = 50;//Brightness

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "色温");
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 2700 & 0xFF;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[2] = (2700 >> 8) & 0xFF;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "卷帘");
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.status = 0x12;
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "窗帘");
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.status = 0x12;
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "地暖");
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "空调");
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "新风");
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Mode = 2;
		TFT_Device_State[13].IT_Dev_Config_Value.IT_Cdaos_Config.Suppot = 1;
		TFT_Device_State[13].IT_Dev_Config_Value.IT_Cdaos_Config.Mode_Suppot = 0x7F;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "百叶");
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ZNZX_HEAT;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "毛细空调");
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Set_Temp = 250;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Room_Temp = 280;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Room_Hum = 58;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Sleep_Mode = 1;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = 7;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "空调2");
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "电视");
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "音乐");
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
	else if (Sys.Language == MG_LANGUAGE_ENG)
	{
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "Be home");
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "Leave home");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "Reception");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "Dine together");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "Ordinary light");
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "Dimming light");
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "Colorlamp");
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "CT light");
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "Roller shutters");
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "Curtains");
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "Heating");
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "Air conditioner");
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "CDOAS");
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "Venetian blind");
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "Air conditioner");
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 50;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 3;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x11;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "Air conditioner");
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "TV");
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "Back music");
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
	else if (Sys.Language == MG_LANGUAGE_ZHTW)
	{

		TFT_Device[1].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;//DEVIC_TYPE_DALI_RGBCW
		TFT_Device[1].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Device.DeviceName, "瓦瑟");
		TFT_Device_State[1].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[1].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[1].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[1].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		//TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		//TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		//strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "回家");
		//TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		//TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "離家");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "會客");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "聚餐");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = 6;
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "燈泡");
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "調光");
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "調色");
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "色溫");
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 2700 & 0xFF;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[2] = (2700 >> 8) & 0xFF;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "卷帘");
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.status = 0x12;
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "窗帘");
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.status = 0x12;
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "地暖");
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "空調");
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "新風");
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "百葉");
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ZNZX_HEAT;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "毛細");
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Set_Temp = 250;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Room_Temp = 280;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Room_Hum = 58;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_ZNZX_Heat_Status.Sleep_Mode = 1;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = 7;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "空調");
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "電視");
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = 6;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "音樂");
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
#else
	for (i = 1; i <= 18; i++)
	{
		TFT_Device[i].DeviceIsAllocation = true;
		TFT_Device[i].DeviceEventType = 1;
		TFT_Device[i].DeviceKeyVol = i;
		TFT_Device[i].TFTSCEQ.TFT_Device.DeviceIcon = 0;
	}
	for (i = 19; i <= DeviceNumMax; i++)
	{
		TFT_Device[i].DeviceIsAllocation = false;
	}
	if (Sys.Language == MG_LANGUAGE_CHS)
	{
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "回家模式");
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "离家模式");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "会客模式");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "聚餐模式");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = 15;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "客厅普通灯");
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "卧室调光");
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "卧室调色");
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = 14;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "餐厅灯带");
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "客厅卷帘");
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = 15;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "客厅开合帘");
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "全屋地暖");
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "次卧空调");
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "餐厅新风");
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = 18;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "厕所百叶窗帘");
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_DX_HEAT;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "毛细空调");
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Set_Temp = 250;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Room_Temp = 280;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Room_Hum = 58;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "客厅空调");
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "客厅电视");
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "背景音乐");
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
	else if (Sys.Language == MG_LANGUAGE_ENG)
	{
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "Be home");
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "Leave home");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "Reception");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "Dine together");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = strlen(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName);
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "Ordinary light");
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "Dimming light");
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "Colorlamp");
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "CT light");
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "Roller shutters");
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "Curtains");
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "Heating");
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "AirConditioner");
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "CDOAS");
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "Venetian blind");
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "AirConditioner");
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 50;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 3;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x11;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "AirConditioner");
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "TV");
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "Back music");
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = strlen(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName);
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
	else if (Sys.Language == MG_LANGUAGE_ZHTW)
	{
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111121;
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceName, "回家模式");
		TFT_Device[1].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[1].DeviceEventType = 2;

		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111131;
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceName, "離家模式");
		TFT_Device[2].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[2].DeviceEventType = 2;

		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111141;
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceName, "會客模式");
		TFT_Device[3].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[3].DeviceEventType = 2;

		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceID.Value = 0x11111151;
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceIcon = 0;
		strcpy(TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceName, "聚餐模式");
		TFT_Device[4].TFTSCEQ.TFT_Scene.DeviceNameLen = 12;
		TFT_Device[4].DeviceEventType = 2;

		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceID.Value = 0x11111161;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_LIGHT;
		TFT_Device[5].TFTSCEQ.TFT_Device.DeviceNameLen = 15;
		strcpy(TFT_Device[5].TFTSCEQ.TFT_Device.DeviceName, "客廳普通燈");
		TFT_Device_State[5].IT_Dev_STatus_Value.IT_Light_Status.status = 1;

		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22222222;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ADJUSTLIGHT;
		TFT_Device[6].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[6].TFTSCEQ.TFT_Device.DeviceName, "臥室調光燈");
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.status = 0;
		TFT_Device_State[6].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceID.Value = 0x22223333;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_TONINGLIGHT;
		TFT_Device[7].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[7].TFTSCEQ.TFT_Device.DeviceName, "臥室調色燈");
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 200;//R
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[1] = 50;//G
		TFT_Device_State[7].IT_Dev_STatus_Value.IT_Light_Status.data[2] = 50;//B

		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceID.Value = 0x33333333;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CTLIGHT;
		TFT_Device[8].TFTSCEQ.TFT_Device.DeviceNameLen = 14;
		strcpy(TFT_Device[8].TFTSCEQ.TFT_Device.DeviceName, "餐廳燈帶");
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.status = 1;
		TFT_Device_State[8].IT_Dev_STatus_Value.IT_Light_Status.data[0] = 50;

		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceID.Value = 0x44444444;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_MECHANICAL_JOURNEY_JCURTAIN;
		TFT_Device[9].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[9].TFTSCEQ.TFT_Device.DeviceName, "客廳卷帘");
		TFT_Device_State[9].IT_Dev_STatus_Value.IT_Motor_Status.angle = 20;

		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceID.Value = 0x55555555;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_JOURNEY_KCURTAIN;
		TFT_Device[10].TFTSCEQ.TFT_Device.DeviceNameLen = 15;
		strcpy(TFT_Device[10].TFTSCEQ.TFT_Device.DeviceName, "客廳開合帘");
		TFT_Device_State[10].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;

		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceID.Value = 0x66666666;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_HEAT;
		TFT_Device[11].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[11].TFTSCEQ.TFT_Device.DeviceName, "全屋地暖");
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.status = 1;
		TFT_Device_State[11].IT_Dev_STatus_Value.IT_Heat_Status.Set_Temp = 40;

		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceID.Value = 0x77777777;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[12].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[12].TFTSCEQ.TFT_Device.DeviceName, "次臥空調");
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 40;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 2;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 3;
		TFT_Device_State[12].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x22;

		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceID.Value = 0x88888888;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_CDOAS;
		TFT_Device[13].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[13].TFTSCEQ.TFT_Device.DeviceName, "餐廳新風");
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.status = 0;
		TFT_Device_State[13].IT_Dev_STatus_Value.IT_Cdaos_Status.Cdaos_Status_Value.Byte.FanSpeed = 3;

		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceID.Value = 0x99999999;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_ELECTRONIC_JOURNEY_BLIND;
		TFT_Device[14].TFTSCEQ.TFT_Device.DeviceNameLen = 18;
		strcpy(TFT_Device[14].TFTSCEQ.TFT_Device.DeviceName, "厠所百葉窗帘");
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.route = 20;
		TFT_Device_State[14].IT_Dev_STatus_Value.IT_Motor_Status.angle = 150;

		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceID.Value = 0xAAAAAAAA;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_DX_HEAT;
		TFT_Device[15].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[15].TFTSCEQ.TFT_Device.DeviceName, "毛細空調");
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.status = 1;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Set_Temp = 250;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Room_Temp = 280;
		TFT_Device_State[15].IT_Dev_STatus_Value.IT_DX_Heat_Status.Room_Hum = 58;

		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceID.Value = 0xBBBBBBBB;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_AIRCONDITION;
		TFT_Device[16].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[16].TFTSCEQ.TFT_Device.DeviceName, "客廳空調");
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.status = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Set_Temp = 52;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Mode = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.Air_Status_Value.Byte.Speed = 1;
		TFT_Device_State[16].IT_Dev_STatus_Value.IT_Air_Status.FanXiang.vol = 0x33;

		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceID.Value = 0xCCCCCCCC;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_TV;
		TFT_Device[17].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[17].TFTSCEQ.TFT_Device.DeviceName, "客廳電視");
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.status = 1;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.P = 10;
		TFT_Device_State[17].IT_Dev_STatus_Value.IT_TV_Status.Volume = 20;

		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceID.Value = 0xDDDDDDDD;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceType = DEVIC_TYPE_GROUP_BACKMUSIC;
		TFT_Device[18].TFTSCEQ.TFT_Device.DeviceNameLen = 12;
		strcpy(TFT_Device[18].TFTSCEQ.TFT_Device.DeviceName, "背景音樂");
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.status = 1;
		TFT_Device_State[18].IT_Dev_STatus_Value.IT_Music_Status.Volume = 20;
	}
#endif
}
//数据有效性检测
void CheckDatasValid(void)
{
	bool SysSaveEn = false, DevSaveEn = false;
	//保存的参数
	if (Sys.Type != DEVICE_TYPE)
	{
		printf("Moorgen INFO : Sys.Type Error!\n");
		Sys.Type = DEVICE_TYPE;	 	//类型
		SysSaveEn = true;
	}
	if (Sys.Channal > DEVICE_CHANNEL_MAX)
	{
		printf("Moorgen INFO : Sys.Channal Error!\n");
		Sys.Channal = 1;
		SysSaveEn = true;
	}
	if (Sys.Addr == 0x00)
	{
		printf("Moorgen INFO : Sys.Addr Error!\n");
		Sys.Addr = 0xFF;
		SysSaveEn = true;
	}
	if (Sys.Language > MG_LANGUAGE_ZHTW)
	{
		printf("Moorgen INFO : Sys.Language Error!\n");
		Sys.Language = MG_LANGUAGE_ZHTW;
		SysSaveEn = true;
	}
	if (Sys.IsDemoMode == 0xFF)
	{
		printf("Moorgen INFO : Sys.IsDemoMode Error!\n");
		Sys.IsDemoMode = false;
		SysSaveEn = true;
	}
	if (Sys.TypeChl == 0 || Sys.TypeChl > 0xFFFF)
	{
		Sys.TypeChl = DEVIC_TYPE_PANEL_NET_CHL;		//通道设备存在指示
		for (int j = 0; j<DEVICE_CHANNEL_MAX; j++)
		{
			Sys.TypeChlNum[j] = 0xff;//通道类型号
		}
		Sys.TypeChlNum[0] = DEVIC_TYPE_PANEL_CHL;
		printf("Moorgen INFO : Sys.TypeChl Error!\n");
	}
	if (Sys_Config.byte.Panal_EN == 0 || Sys_Config.byte.Panal_EN > 2)
	{
		printf("Moorgen INFO : Sys_Config.byte.Panal_EN Error!\n");
		Sys_Config.byte.Panal_EN = 0x01;
		SysSaveEn = true;
	}
	if ((Sys_Config.byte.SleepTimeover == 0 || Sys_Config.byte.SleepTimeover > 30) && Sys_Config.byte.SleepTimeover != 0xFF)
	{
		printf("Moorgen INFO : Sys_Config.byte.SleepTimeover Error!\n");
		Sys_Config.byte.SleepTimeover = 0x06;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.LightPercent == 0 || Sys_Config.byte.LightPercent > 100)
	{
		printf("Moorgen INFO : Sys_Config.byte.LightPercent Error!\n");
		Sys_Config.byte.LightPercent = 80;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Screensaver_En == 0 || Sys_Config.byte.Screensaver_En > 2)
	{
		printf("Moorgen INFO : Sys_Config.byte.Screensaver_En Error!\n");
		Sys_Config.byte.Screensaver_En = 0x01;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Screensaver_Type == 0 || (Sys_Config.byte.Screensaver_Type > 0x0E && Sys_Config.byte.Screensaver_Type != 0xAA))
	{
		printf("Moorgen INFO : Sys_Config.byte.Screensaver_Type Error!\n");
		Sys_Config.byte.Screensaver_Type = 0x01;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Surname[0] >= 0xFC)
	{
		printf("Moorgen INFO : Sys_Config.byte.Surname Error!\n");
		memset(Sys_Config.byte.Surname, 0, sizeof(Sys_Config.byte.Surname));
#ifndef WIN32
		strcpy(Sys_Config.byte.Surname, "陈");
#endif
		SysSaveEn = true;
	}
	if (Sys_Config.byte.ScrollingTime > 300)
	{
		printf("Moorgen INFO : Sys_Config.byte.ScrollingTime Error!\n");
		Sys_Config.byte.ScrollingTime = 5;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Gesture_En == 0 || Sys_Config.byte.Gesture_En > 2)
	{
		printf("Moorgen INFO : Sys_Config.byte.Gesture_En Error!\n");
		Sys_Config.byte.Gesture_En = 0x02;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Gesture_Config > 0x0F)
	{
		printf("Moorgen INFO : Sys_Config.byte.Gesture_Config Error!\n");
		Sys_Config.byte.Gesture_Config = 0x0F;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Rotate_Light == 0 || Sys_Config.byte.Rotate_Light > 0x02)
	{
		printf("Moorgen INFO : Sys_Config.byte.Rotate_Light Error!\n");
		Sys_Config.byte.Rotate_Light = 0x02;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.Rotate_Voice == 0 || Sys_Config.byte.Rotate_Voice > 0x02)
	{
		printf("Moorgen INFO : Sys_Config.byte.Rotate_Voice Error!\n");
		Sys_Config.byte.Rotate_Voice = 0x01;
		SysSaveEn = true;
	}
	if (Sys_Config.byte.ScreensaverLoop_Select == 0)
	{
		printf("Moorgen INFO : Sys_Config.byte.ScreensaverLoop_Select Error!\n");
		Sys_Config.byte.ScreensaverLoop_Select = 0x01FF;
		SysSaveEn = true;
	}
	if (Sys.IsDemoMode > 0x01)
	{
		printf("Moorgen INFO : Sys.IsDemoMode Error!\n");
		Sys.IsDemoMode = false;
		SysSaveEn = true;
	}
	if (SysSaveEn) WriteSystemData();
	if (Dev.LedRing_Switch > 0x01)
	{
		printf("Moorgen INFO : Dev.LedRing_Switch Error!\n");
		Dev.LedRing_Switch = ON;
		DevSaveEn = true;
	}
	if (Dev.LedRing_Brightness > 100)
	{
		printf("Moorgen INFO : Dev.LedRing_Brightness Error!\n");
		Dev.LedRing_Brightness = 100;
		DevSaveEn = true;
	}
	if (DevSaveEn) WriteDeviceNowData();
}
//储存进程，只能在这里调用储存接口
void EepromSaveProgress(void)
{
	//储存系统参数
	if (MessageFlag[MSG_SAVE_SYS] == ON)
	{
		MessageFlag[MSG_SAVE_SYS] = OFF;
		WriteSystemData();
	}
	//储存系统参数
	if (MessageFlag[MSG_SAVE_SYS_CONFIG] == ON)
	{
		MessageFlag[MSG_SAVE_SYS_CONFIG] = OFF;
		SaveSystemConfigData(1,0xFF);
	}
	//恢复出厂数据
	if (MessageFlag[MSG_SAVE_RENEW] == ON)
	{
		MessageFlag[MSG_SAVE_RENEW] = OFF;
		SystemDataReNew();
		ituSceneUpdate(&theScene, ITU_EVENT_LANGUAGE, Sys.Language, 0, 0);
		MessageFlag[MSG_GUI_CONFIG_UPDATE] = ON;//界面设备配置跟新
		GotoMainMenu();
	}
	//储存设备数据
	if (MessageFlag[MSG_SAVE_DEVICE_DATA] == ON)
	{
		MessageFlag[MSG_SAVE_DEVICE_DATA] = OFF;
		if (!Sys.IsDemoMode)
			WriteDeviceData(0xFF);
	}
	//储存面板本身状态
	if (MessageFlag[MSG_SAVE_NOWDATA] == ON)
	{
		MessageFlag[MSG_SAVE_NOWDATA] = OFF;
		WriteDeviceNowData();
	}
	//储存照片1
	if (MessageFlag[MSG_SAVE_PHOTO1_DATA] == ON)
	{
		MessageFlag[MSG_SAVE_PHOTO1_DATA] = OFF;
		WritePhotoData(1);
	}
	//储存照片2
	if (MessageFlag[MSG_SAVE_PHOTO2_DATA] == ON)
	{
		MessageFlag[MSG_SAVE_PHOTO2_DATA] = OFF;
		WritePhotoData(2);
	}
	//储存照片3
	if (MessageFlag[MSG_SAVE_PHOTO3_DATA] == ON)
	{
		MessageFlag[MSG_SAVE_PHOTO3_DATA] = OFF;
		WritePhotoData(3);
	}
	if (MessageFlag[MSG_SAVE_CHILD_AIR_STATE] == ON)
	{
		Save_Air_State();
		MessageFlag[MSG_SAVE_CHILD_AIR_STATE] = OFF;
	}
	if (MessageFlag[MSG_SAVE_CHILD_HEAT_STATE] == ON)
	{
		Save_Heat_State();
		MessageFlag[MSG_SAVE_CHILD_HEAT_STATE] = OFF;
	}
	if (MessageFlag[MSG_SAVE_CHILD_CDOAS_STATE] == ON)
	{
		Save_Cdoas_State();
		MessageFlag[MSG_SAVE_CHILD_CDOAS_STATE] = OFF;
	}
	if (MessageFlag[MSG_SAVE_CHILD_AIR_CONFIG] == ON)
	{
		Save_Air_Config(1, 0xFF);
		MessageFlag[MSG_SAVE_CHILD_AIR_CONFIG] = OFF;
	}
	if (MessageFlag[MSG_SAVE_CHILD_HEAT_CONFIG] == ON)
	{
		Save_Heat_Config(1, 0xFF);
		MessageFlag[MSG_SAVE_CHILD_HEAT_CONFIG] = OFF;
	}
	if (MessageFlag[MSG_SAVE_CHILD_CDOAS_CONFIG] == ON)
	{
		Save_Cdoas_Config(1,0xFF);
		MessageFlag[MSG_SAVE_CHILD_CDOAS_CONFIG] = OFF;
	}
}